﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace SLARToolKitWinPhoneSample
{
    public partial class CalorieBurn_Cal : PhoneApplicationPage
    {
        public CalorieBurn_Cal()
        {
            InitializeComponent();
        }

        private void HandleCheck(object sender, RoutedEventArgs e)
        {
            RadioButton rb = sender as RadioButton;
            //choiceTextBlock.Text = "You chose: " + rb.GroupName + ": " + rb.Name;
        }

        private void weight_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (weight_box.Text == "Weight in kg")
                weight_box.Text = "";
        }
        private void weight_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (weight_box.Text == "")
                weight_box.Text = "Weight in kg";
        }

        private void Sleeping_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Sleeping_minute_box.Text == "0")
                Sleeping_minute_box.Text = "";
        }
        private void Sleeping_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Sleeping_minute_box.Text == "")
                Sleeping_minute_box.Text = "0";
        }

        private void Sitting_quietly_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Sitting_quietly_minute_box.Text == "0")
                Sitting_quietly_minute_box.Text = "";
        }

        private void Sitting_quietly_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Sitting_quietly_minute_box.Text == "")
                Sitting_quietly_minute_box.Text = "0";
        }

        private void Knitting_sewing_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Knitting_sewing_minute_box.Text == "0")
                Knitting_sewing_minute_box.Text = "";
        }

        private void Knitting_sewing_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Knitting_sewing_minute_box.Text == "")
                Knitting_sewing_minute_box.Text = "0";
        }

        private void Sitting_eating_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Sitting_eating_minute_box.Text == "0")
                Sitting_eating_minute_box.Text = "";
        }

        private void Sitting_eating_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Sitting_eating_minute_box.Text == "")
                Sitting_eating_minute_box.Text = "0";
        }

        private void Standing_quietly_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Standing_quietly_minute_box.Text == "0")
                Standing_quietly_minute_box.Text = "";
        }

        private void Standing_quietly_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Standing_quietly_minute_box.Text == "")
                Standing_quietly_minute_box.Text = "0";
        }

        private void Typing_electric_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Typing_electric_minute_box.Text == "0")
                Typing_electric_minute_box.Text = "";
        }

        private void Typing_electric_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Typing_electric_minute_box.Text == "")
                Typing_electric_minute_box.Text = "0";
        }

        private void Sitting_writing_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Sitting_writing_minute_box.Text == "0")
                Sitting_writing_minute_box.Text = "";
        }

        private void Sitting_writing_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Sitting_writing_minute_box.Text == "")
                Sitting_writing_minute_box.Text = "0";
        }

        private void Ironing_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Ironing_minute_box.Text == "0")
                Ironing_minute_box.Text = "";
        }

        private void Ironing_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Ironing_minute_box.Text == "")
                Ironing_minute_box.Text = "0";
        }

        private void Cooking_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Cooking_minute_box.Text == "0")
                Cooking_minute_box.Text = "";
        }

        private void Cooking_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Cooking_minute_box.Text == "")
                Cooking_minute_box.Text = "0";
        }

        private void Volleyball_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Volleyball_minute_box.Text == "0")
                Volleyball_minute_box.Text = "";
        }

        private void Volleyball_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Volleyball_minute_box.Text == "")
                Volleyball_minute_box.Text = "0";
        }

        private void Walking_slowly_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Walking_slowly_minute_box.Text == "0")
                Walking_slowly_minute_box.Text = "";
        }

        private void Walking_slowly_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Walking_slowly_minute_box.Text == "")
                Walking_slowly_minute_box.Text = "0";
        }

        private void Light_housework_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Light_housework_minute_box.Text == "0")
                Light_housework_minute_box.Text = "";
        }

        private void Light_housework_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Light_housework_minute_box.Text == "")
                Light_housework_minute_box.Text = "0";
        }

        private void Food_shopping_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Food_shopping_minute_box.Text == "0")
                Food_shopping_minute_box.Text = "";
        }

        private void Food_shopping_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Food_shopping_minute_box.Text == "")
                Food_shopping_minute_box.Text = "0";
        }

        private void Mopping_floor_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Mopping_floor_minute_box.Text == "0")
                Mopping_floor_minute_box.Text = "";
        }

        private void Mopping_floor_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Mopping_floor_minute_box.Text == "")
                Mopping_floor_minute_box.Text = "0";
        }

        private void Cycling_leisure_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Cycling_leisure_minute_box.Text == "0")
                Cycling_leisure_minute_box.Text = "";
        }

        private void Cycling_leisure_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Cycling_leisure_minute_box.Text == "")
                Cycling_leisure_minute_box.Text = "0";
        }

        private void Table_tennis_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Table_tennis_minute_box.Text == "0")
                Table_tennis_minute_box.Text = "";
        }

        private void Table_tennis_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Table_tennis_minute_box.Text == "")
                Table_tennis_minute_box.Text = "0";
        }

        private void Walking_briskly_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if( Walking_briskly_minute_box.Text == "0")
                Walking_briskly_minute_box.Text = "";
        }

        private void Walking_briskly_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Walking_briskly_minute_box.Text == "")
                Walking_briskly_minute_box.Text = "0";
        }

        private void Golf_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Golf_minute_box.Text == "0")
                Golf_minute_box.Text = "";
        }

        private void Golf_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Golf_minute_box.Text == "")
                Golf_minute_box.Text = "0";
        }

        private void Badminton_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Badminton_minute_box.Text == "0")
                Badminton_minute_box.Text = "";
        }

        private void Badminton_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Badminton_minute_box.Text == "")
                Badminton_minute_box.Text = "0";
        }

        private void Dancing_medium_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Dancing_medium_minute_box.Text == "0")
                Dancing_medium_minute_box.Text = "";
        }

        private void Dancing_medium_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Dancing_medium_minute_box.Text == "")
                Dancing_medium_minute_box.Text = "0";
        }

        private void Tennis_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Tennis_minute_box.Text == "0")
                Tennis_minute_box.Text = "";
        }

        private void Tennis_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Tennis_minute_box.Text == "")
                Tennis_minute_box.Text = "0";
        }

        private void Jogging_slow_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Jogging_slow_minute_box.Text == "0")
                Jogging_slow_minute_box.Text = "";
        }

        private void Jogging_slow_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Jogging_slow_minute_box.Text == "")
                Jogging_slow_minute_box.Text = "0";
        }

        private void Gardening_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Gardening_minute_box.Text == "0")
                Gardening_minute_box.Text = "";
        }

        private void Gardening_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Gardening_minute_box.Text == "")
                Gardening_minute_box.Text = "0";
        }

        private void Swimming_crawl_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_crawl_slow_minute_box.Text == "0")
                Swimming_crawl_slow_minute_box.Text = "";
        }

        private void Swimming_crawl_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_crawl_slow_minute_box.Text == "")
                Swimming_crawl_slow_minute_box.Text = "0";
        }

        private void Football_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Football_minute_box.Text == "0")
                Football_minute_box.Text = "";
        }

        private void Football_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Football_minute_box.Text == "")
                Football_minute_box.Text = "0";
        }

        private void Dancing_intense_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Dancing_intense_minute_box.Text == "0")
                Dancing_intense_minute_box.Text = "";
        }

        private void Dancing_intense_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Dancing_intense_minute_box.Text == "")
                Dancing_intense_minute_box.Text = "0";
        }

        private void Basketball_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Basketball_minute_box.Text == "0")
                Basketball_minute_box.Text = "";
        }

        private void Basketball_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Basketball_minute_box.Text == "")
                Basketball_minute_box.Text = "0";
        }

        private void Running_slow_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Running_slow_minute_box.Text == "0")
                Running_slow_minute_box.Text = "";
        }

        private void Running_slow_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Running_slow_minute_box.Text == "")
                Running_slow_minute_box.Text = "0";
        }

        private void Swimming_crawl_fast_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_crawl_fast_minute_box.Text == "0")
                Swimming_crawl_fast_minute_box.Text = "";
        }

        private void Swimming_crawl_fast_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_crawl_fast_minute_box.Text == "")
                Swimming_crawl_fast_minute_box.Text = "0";
        }

        private void Swimming_breaststroke_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_breaststroke_minute_box.Text == "0")
                Swimming_breaststroke_minute_box.Text = "";
        }

        private void Swimming_breaststroke_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_breaststroke_minute_box.Text == "")
                Swimming_breaststroke_minute_box.Text = "0";
        }

        private void Swimming_backstroke_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_backstroke_minute_box.Text == "0")
                Swimming_backstroke_minute_box.Text = "";
        }

        private void Swimming_backstroke_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Swimming_backstroke_minute_box.Text == "")
                Swimming_backstroke_minute_box.Text = "0";
        }

        private void Running_medium_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Running_medium_minute_box.Text == "0")
                Running_medium_minute_box.Text = "";
        }

        private void Running_medium_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Running_medium_minute_box.Text == "")
                Running_medium_minute_box.Text = "0";
        }

        private void Running_fast_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Running_fast_minute_box.Text == "0")
                Running_fast_minute_box.Text = "";
        }

        private void Running_fast_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Running_fast_minute_box.Text == "")
                Running_fast_minute_box.Text = "0";
        }

        private void Squash_minute_box_GotFocus(object sender, RoutedEventArgs e)
        {
            if (Squash_minute_box.Text == "0")
                Squash_minute_box.Text = "";
        }

        private void Squash_minute_box_LostFocus(object sender, RoutedEventArgs e)
        {
            if (Squash_minute_box.Text == "")
                Squash_minute_box.Text = "0";
        }

        private void calculate_button_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                Double w = Convert.ToDouble(weight_box.Text);
                if ((w < 20) || (w > 400))
                {
                    MessageBox.Show("Please key in valid weight number.");
                    return;
                }

                Double Sleeping_m = Convert.ToDouble(Sleeping_minute_box.Text);
                Double Sitting_quietly_m = Convert.ToDouble(Sitting_quietly_minute_box.Text);
                Double Knitting_m = Convert.ToDouble(Knitting_sewing_minute_box.Text);
                Double Sitting_eating_m = Convert.ToDouble(Sitting_eating_minute_box.Text);
                Double Standing_quietly_m = Convert.ToDouble(Standing_quietly_minute_box.Text);
				Double Typing_electric_m = Convert.ToDouble(Typing_electric_minute_box.Text);
				Double Sitting_writing_m = Convert.ToDouble(Sitting_writing_minute_box.Text);
				Double Ironing_m = Convert.ToDouble(Ironing_minute_box.Text);
				Double Cooking_m = Convert.ToDouble(Cooking_minute_box.Text);
				Double Volleyball_m = Convert.ToDouble(Volleyball_minute_box.Text);
				Double Walking_slowly_m = Convert.ToDouble(Walking_slowly_minute_box.Text);
				Double Light_housework_m = Convert.ToDouble(Light_housework_minute_box.Text);
				Double Food_shopping_m = Convert.ToDouble(Food_shopping_minute_box.Text);
				Double Mopping_floor_m = Convert.ToDouble(Mopping_floor_minute_box.Text);
				Double Cycling_leisure_m = Convert.ToDouble(Cycling_leisure_minute_box.Text);
				Double Table_tennis_m = Convert.ToDouble(Table_tennis_minute_box.Text);
				Double Walking_briskly_m = Convert.ToDouble(Walking_briskly_minute_box.Text);
				Double Golf_m = Convert.ToDouble(Golf_minute_box.Text);
				Double Badminton_m = Convert.ToDouble(Badminton_minute_box.Text);
				Double Dancing_medium_m = Convert.ToDouble(Dancing_medium_minute_box.Text);
				Double Tennis_m = Convert.ToDouble(Tennis_minute_box.Text);
				Double Jogging_slow_m = Convert.ToDouble(Jogging_slow_minute_box.Text);
				Double Gardening_m = Convert.ToDouble(Gardening_minute_box.Text);
				Double Swimming_crawl_slow_m = Convert.ToDouble(Swimming_crawl_slow_minute_box.Text);
				Double Football_m = Convert.ToDouble(Football_minute_box.Text);
				Double Dancing_intense_m = Convert.ToDouble(Dancing_intense_minute_box.Text);
				Double Basketball_m = Convert.ToDouble(Basketball_minute_box.Text);
				Double Running_slow_m = Convert.ToDouble(Running_slow_minute_box.Text);
				Double Swimming_crawl_fast_m = Convert.ToDouble(Swimming_crawl_fast_minute_box.Text);
				Double Swimming_breaststroke_m = Convert.ToDouble(Swimming_breaststroke_minute_box.Text);
				Double Swimming_backstroke_m = Convert.ToDouble(Swimming_backstroke_minute_box.Text);
				Double Running_medium_m = Convert.ToDouble(Running_medium_minute_box.Text);
				Double Running_fast_m = Convert.ToDouble(Running_fast_minute_box.Text);
                Double Squash_m = Convert.ToDouble(Squash_minute_box.Text);
                
                if (rbM.IsChecked == true)
                {
                   
                    Double Sleeping_calorie = 0.018 * Sleeping_m * w;
                    Sleeping_calorie_box.Text = Math.Round(Sleeping_calorie, 1).ToString();

                    Double Sitting_quietly_calorie = 0.021 * Sitting_quietly_m * w;
                    Sitting_quietly_calorie_box.Text = Math.Round(Sitting_quietly_calorie, 1).ToString();

                    Double Knitting_calorie = 0.022 * Knitting_m * w;
                    Knitting_sewing_calorie_box.Text = Math.Round(Knitting_calorie, 1).ToString();

                    Double Sitting_eating_calorie = 0.023 * Sitting_eating_m * w;
                    Sitting_eating_calorie_box.Text= Math.Round(Sitting_eating_calorie, 1).ToString();

                    Double Standing_quietly_calorie = 0.026 * Standing_quietly_m * w;
                    Standing_quietly_calorie_box.Text= Math.Round(Standing_quietly_calorie, 1).ToString();

                    Double Typing_electric_calorie = 0.027 *Typing_electric_m * w;
                     Typing_electric_calorie_box.Text= Math.Round(Typing_electric_calorie, 1).ToString();

                    Double Sitting_writing_calorie = 0.029 * Sitting_writing_m * w;
                    Sitting_writing_calorie_box.Text= Math.Round(Sitting_writing_calorie, 1).ToString();

                    Double Ironing_calorie = 0.033 * Ironing_m * w;
                    Ironing_calorie_box.Text= Math.Round(Ironing_calorie, 1).ToString();

                    Double Cooking_calorie = 0.045 * Cooking_m * w;
                    Cooking_calorie_box.Text= Math.Round(Cooking_calorie, 1).ToString();

                    Double Volleyball_calorie = 0.05 * Volleyball_m * w;
                    Volleyball_calorie_box.Text= Math.Round(Volleyball_calorie, 1).ToString();

                    Double Walking_slowly_calorie = 0.055 * Walking_slowly_m * w;
                    Walking_slowly_calorie_box.Text= Math.Round(Walking_slowly_calorie,1).ToString();

                    Double Light_housework_calorie = 0.06 * Light_housework_m * w;
                    Light_housework_calorie_box.Text= Math.Round(Light_housework_calorie, 1).ToString();

                    Double Food_shopping_calorie = 0.058 * Food_shopping_m * w;
                    Food_shopping_calorie_box.Text= Math.Round(Food_shopping_calorie, 1).ToString();

                    Double Mopping_floor_calorie = 0.062 * Mopping_floor_m * w;
                    Mopping_floor_calorie_box.Text= Math.Round( Mopping_floor_calorie, 1).ToString();

                    Double Cycling_leisure_calorie = 0.064 * Cycling_leisure_m * w;
                    Cycling_leisure_calorie_box.Text= Math.Round(Cycling_leisure_calorie, 1).ToString();

                    Double Table_tennis_calorie = 0.068 * Table_tennis_m * w;
                    Table_tennis_calorie_box.Text= Math.Round(Table_tennis_calorie, 1).ToString();

                    Double Walking_briskly_calorie = 0.073 * Walking_briskly_m * w;
                    Walking_briskly_calorie_box.Text= Math.Round(Walking_briskly_calorie, 1).ToString();

                    Double Golf_calorie = 0.085 * Golf_m * w;
                    Golf_calorie_box.Text= Math.Round(Golf_calorie, 1).ToString();

                    Double Badminton_calorie = 0.097 * Badminton_m * w;
                    Badminton_calorie_box.Text= Math.Round(Badminton_calorie, 1).ToString();

                    Double Dancing_medium_calorie = 0.103 * Dancing_medium_m * w;
                    Dancing_medium_calorie_box.Text= Math.Round(Dancing_medium_calorie, 1).ToString();

                    Double Tennis_calorie = 0.109 * Tennis_m * w;
                     Tennis_calorie_box.Text= Math.Round(Tennis_calorie, 1).ToString();

                    Double Jogging_slow_calorie = 0.112 * Jogging_slow_m * w;
                     Jogging_slow_calorie_box.Text= Math.Round(Jogging_slow_calorie, 1).ToString();

                    Double Gardening_calorie = 0.126 * Gardening_m * w;
                    Gardening_calorie_box.Text= Math.Round(Gardening_calorie, 1).ToString();

                    Double Swimming_crawl_slow_calorie = 0.128 * Swimming_crawl_slow_m * w;
                    Swimming_crawl_slow_calorie_box.Text= Math.Round(Swimming_crawl_slow_calorie, 1).ToString();

                    Double Football_calorie = 0.132 * Football_m * w;
                    Football_calorie_box.Text= Math.Round(Football_calorie, 1).ToString();

                    Double Dancing_intense_calorie = 0.135 * Dancing_intense_m * w;
                    Dancing_intense_calorie_box.Text= Math.Round(Dancing_intense_calorie, 1).ToString();

                    Double Basketball_calorie = 0.138 * Basketball_m * w;
                    Basketball_calorie_box.Text= Math.Round(Basketball_calorie, 1).ToString();

                    Double Running_slow_calorie = 0.146 * Running_slow_m * w;
                     Running_slow_calorie_box.Text= Math.Round(Running_slow_calorie, 1).ToString();

                    Double Swimming_crawl_fast_calorie = 0.156 * Swimming_crawl_fast_m * w;
                    Swimming_crawl_fast_calorie_box.Text= Math.Round(Swimming_crawl_fast_calorie, 1).ToString();

                    Double Swimming_breaststroke_calorie = 0.162 * Swimming_breaststroke_m * w;
                    Swimming_breaststroke_calorie_box.Text= Math.Round(Swimming_breaststroke_calorie, 1).ToString();

                    Double Swimming_backstroke_calorie = 0.169 * Swimming_backstroke_m * w;
                    Swimming_backstroke_calorie_box.Text= Math.Round(Swimming_backstroke_calorie, 1).ToString();

                    Double Running_medium_calorie = 0.174 * Running_medium_m * w;
                    Running_medium_calorie_box.Text= Math.Round(Running_medium_calorie, 1).ToString();

                    Double Running_fast_calorie = 0.2 * Running_fast_m * w;
                     Running_fast_calorie_box.Text= Math.Round(Running_fast_calorie, 1).ToString();

                    Double Squash_calorie = 0.212 * Squash_m * w;
                    Squash_calorie_box.Text = Math.Round(Squash_calorie, 1).ToString();

                    Double total_minute = Sleeping_m + Sitting_quietly_m + Knitting_m + Sitting_eating_m + Standing_quietly_m + Typing_electric_m + Sitting_writing_m + Ironing_m + Cooking_m + Volleyball_m + Walking_slowly_m + Light_housework_m + Food_shopping_m + Mopping_floor_m +
                 Cycling_leisure_m + Table_tennis_m + Walking_briskly_m + Golf_m + Badminton_m + Dancing_medium_m + Tennis_m + Jogging_slow_m + Gardening_m + Swimming_crawl_slow_m + Football_m + Dancing_intense_m +
                 Basketball_m + Running_slow_m + Swimming_crawl_fast_m + Swimming_breaststroke_m + Swimming_backstroke_m + Running_medium_m + Running_fast_m + Squash_m;
                    total_minutes.Text = Math.Round(total_minute, 0).ToString();

                    Double total = Sleeping_calorie + Sitting_quietly_calorie + Knitting_calorie + Sitting_eating_calorie + Standing_quietly_calorie + Typing_electric_calorie + Sitting_writing_calorie + Ironing_calorie + Cooking_calorie + Volleyball_calorie + Walking_slowly_calorie + Light_housework_calorie + Food_shopping_calorie + Mopping_floor_calorie +
                 Cycling_leisure_calorie + Table_tennis_calorie + Walking_briskly_calorie + Golf_calorie + Badminton_calorie + Dancing_medium_calorie + Tennis_calorie + Jogging_slow_calorie + Gardening_calorie + Swimming_crawl_slow_calorie + Football_calorie + Dancing_intense_calorie +
                 Basketball_calorie + Running_slow_calorie + Swimming_crawl_fast_calorie + Swimming_breaststroke_calorie + Swimming_backstroke_calorie + Running_medium_calorie + Running_fast_calorie + Squash_calorie;

                    total_calories.Text = Math.Round(total, 0).ToString();
                }
                else if (rbF.IsChecked == true)
                {

                    Double Sleeping_calorie = 0.018 * Sleeping_m * w;
                    Sleeping_calorie_box.Text = Math.Round(Sleeping_calorie, 1).ToString();

                    Double Sitting_quietly_calorie = 0.021 * Sitting_quietly_m * w;
                    Sitting_quietly_calorie_box.Text = Math.Round(Sitting_quietly_calorie, 1).ToString();

                    Double Knitting_calorie = 0.022 * Knitting_m * w;
                    Knitting_sewing_calorie_box.Text = Math.Round(Knitting_calorie, 1).ToString();

                    Double Sitting_eating_calorie = 0.023 * Sitting_eating_m * w;
                    Sitting_eating_calorie_box.Text = Math.Round(Sitting_eating_calorie, 1).ToString();

                    Double Standing_quietly_calorie = 0.026 * Standing_quietly_m * w;
                    Standing_quietly_calorie_box.Text = Math.Round(Standing_quietly_calorie, 1).ToString();

                    Double Typing_electric_calorie = 0.027 * Typing_electric_m * w;
                    Typing_electric_calorie_box.Text = Math.Round(Typing_electric_calorie, 1).ToString();

                    Double Sitting_writing_calorie = 0.029 * Sitting_writing_m * w;
                    Sitting_writing_calorie_box.Text = Math.Round(Sitting_writing_calorie, 1).ToString();

                    Double Ironing_calorie = 0.033 * Ironing_m * w;
                    Ironing_calorie_box.Text = Math.Round(Ironing_calorie, 1).ToString();

                    Double Cooking_calorie = 0.045 * Cooking_m * w;
                    Cooking_calorie_box.Text = Math.Round(Cooking_calorie, 1).ToString();

                    Double Volleyball_calorie = 0.05 * Volleyball_m * w;
                    Volleyball_calorie_box.Text = Math.Round(Volleyball_calorie, 1).ToString();

                    Double Walking_slowly_calorie = 0.058 * Walking_slowly_m * w;
                    Walking_slowly_calorie_box.Text = Math.Round(Walking_slowly_calorie, 1).ToString();

                    Double Light_housework_calorie = 0.06 * Light_housework_m * w;
                    Light_housework_calorie_box.Text = Math.Round(Light_housework_calorie, 1).ToString();

                    Double Food_shopping_calorie = 0.062 * Food_shopping_m * w;
                    Food_shopping_calorie_box.Text = Math.Round(Food_shopping_calorie, 1).ToString();

                    Double Mopping_floor_calorie = 0.062 * Mopping_floor_m * w;
                    Mopping_floor_calorie_box.Text = Math.Round(Mopping_floor_calorie, 1).ToString();

                    Double Cycling_leisure_calorie = 0.064 * Cycling_leisure_m * w;
                    Cycling_leisure_calorie_box.Text = Math.Round(Cycling_leisure_calorie, 1).ToString();

                    Double Table_tennis_calorie = 0.068 * Table_tennis_m * w;
                    Table_tennis_calorie_box.Text = Math.Round(Table_tennis_calorie, 1).ToString();

                    Double Walking_briskly_calorie = 0.074 * Walking_briskly_m * w;
                    Walking_briskly_calorie_box.Text = Math.Round(Walking_briskly_calorie, 1).ToString();

                    Double Golf_calorie = 0.085 * Golf_m * w;
                    Golf_calorie_box.Text = Math.Round(Golf_calorie, 1).ToString();

                    Double Badminton_calorie = 0.097 * Badminton_m * w;
                    Badminton_calorie_box.Text = Math.Round(Badminton_calorie, 1).ToString();

                    Double Dancing_medium_calorie = 0.103 * Dancing_medium_m * w;
                    Dancing_medium_calorie_box.Text = Math.Round(Dancing_medium_calorie, 1).ToString();

                    Double Tennis_calorie = 0.109 * Tennis_m * w;
                    Tennis_calorie_box.Text = Math.Round(Tennis_calorie, 1).ToString();

                    Double Jogging_slow_calorie = 0.112 * Jogging_slow_m * w;
                    Jogging_slow_calorie_box.Text = Math.Round(Jogging_slow_calorie, 1).ToString();

                    Double Gardening_calorie = 0.126 * Gardening_m * w;
                    Gardening_calorie_box.Text = Math.Round(Gardening_calorie, 1).ToString();

                    Double Swimming_crawl_slow_calorie = 0.128 * Swimming_crawl_slow_m * w;
                    Swimming_crawl_slow_calorie_box.Text = Math.Round(Swimming_crawl_slow_calorie, 1).ToString();

                    Double Football_calorie = 0.132 * Football_m * w;
                    Football_calorie_box.Text = Math.Round(Football_calorie, 1).ToString();

                    Double Dancing_intense_calorie = 0.135 * Dancing_intense_m * w;
                    Dancing_intense_calorie_box.Text = Math.Round(Dancing_intense_calorie, 1).ToString();

                    Double Basketball_calorie = 0.138 * Basketball_m * w;
                    Basketball_calorie_box.Text = Math.Round(Basketball_calorie, 1).ToString();

                    Double Running_slow_calorie = 0.153 * Running_slow_m * w;
                    Running_slow_calorie_box.Text = Math.Round(Running_slow_calorie, 1).ToString();

                    Double Swimming_crawl_fast_calorie = 0.156 * Swimming_crawl_fast_m * w;
                    Swimming_crawl_fast_calorie_box.Text = Math.Round(Swimming_crawl_fast_calorie, 1).ToString();

                    Double Swimming_breaststroke_calorie = 0.162 * Swimming_breaststroke_m * w;
                    Swimming_breaststroke_calorie_box.Text = Math.Round(Swimming_breaststroke_calorie, 1).ToString();

                    Double Swimming_backstroke_calorie = 0.169 * Swimming_backstroke_m * w;
                    Swimming_backstroke_calorie_box.Text = Math.Round(Swimming_backstroke_calorie, 1).ToString();

                    Double Running_medium_calorie = 0.182 * Running_medium_m * w;
                    Running_medium_calorie_box.Text = Math.Round(Running_medium_calorie, 1).ToString();

                    Double Running_fast_calorie = 0.2 * Running_fast_m * w;
                    Running_fast_calorie_box.Text = Math.Round(Running_fast_calorie, 1).ToString();

                    Double Squash_calorie = 0.212 * Squash_m * w;
                    Squash_calorie_box.Text = Math.Round(Squash_calorie, 1).ToString();

                    Double total_minute = Sleeping_m + Sitting_quietly_m + Knitting_m + Sitting_eating_m + Standing_quietly_m + Typing_electric_m + Sitting_writing_m + Ironing_m + Cooking_m + Volleyball_m + Walking_slowly_m + Light_housework_m + Food_shopping_m + Mopping_floor_m +
                 Cycling_leisure_m + Table_tennis_m + Walking_briskly_m + Golf_m + Badminton_m + Dancing_medium_m + Tennis_m + Jogging_slow_m + Gardening_m + Swimming_crawl_slow_m + Football_m + Dancing_intense_m +
                 Basketball_m + Running_slow_m + Swimming_crawl_fast_m + Swimming_breaststroke_m + Swimming_backstroke_m + Running_medium_m + Running_fast_m + Squash_m;
                    total_minutes.Text = Math.Round(total_minute, 0).ToString();

                    Double total = Sleeping_calorie + Sitting_quietly_calorie + Knitting_calorie + Sitting_eating_calorie + Standing_quietly_calorie + Typing_electric_calorie + Sitting_writing_calorie + Ironing_calorie + Cooking_calorie + Volleyball_calorie + Walking_slowly_calorie + Light_housework_calorie + Food_shopping_calorie + Mopping_floor_calorie +
                 Cycling_leisure_calorie + Table_tennis_calorie + Walking_briskly_calorie + Golf_calorie + Badminton_calorie + Dancing_medium_calorie + Tennis_calorie + Jogging_slow_calorie + Gardening_calorie + Swimming_crawl_slow_calorie + Football_calorie + Dancing_intense_calorie +
                 Basketball_calorie + Running_slow_calorie + Swimming_crawl_fast_calorie + Swimming_breaststroke_calorie + Swimming_backstroke_calorie + Running_medium_calorie + Running_fast_calorie + Squash_calorie;

                    total_calories.Text = Math.Round(total, 0).ToString();
                }
            }
            catch (Exception exc)
            {

                MessageBox.Show("Please key in your details.");


            }
        }
    }
}